Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

110
Vistas
How to pass parameters on "Press Enter" jquery php

I am workig with jquery and php,I have input type textbox and i want to execute function by "onclick" OR "Press Enter button" But problem is ...i am trying to pass parameters (via data attributes) to anoter function then nothing works,Here is my code

 <input type="text" id="txt" class="feed_in_input fi1" name="">

Here is my script

$('.fi1').keypress(function(e) {
    if (e.which == 13) {
     e.preventDefault();
      handleClickAndEnter(e);
    }
  });

$('.feed_reply_smiley').on('click', function(e) {
    handleClickAndEnter(e)
});


function handleClickAndEnter(e) 
    {
        var txt_id = $(this).attr('id').replace('button', 'txt');
        var vals = $('#'+txt_id).val();
        var pst=$(this).data('pst');
        var cst=$(this).data('cst');
        var pidd=$(this).data('pidd');
        alert(txt_id + vals);

        .....ajax code
        ....
    }

If i just use "onclick" function then all parameters passing properly but i want to pass parameters in both condition ("onclick" or "Press enter button") How can i do this ? Where i am wrong ? Thanks in advance

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda